package com.gitee.linmt.entity;

import org.springframework.security.core.GrantedAuthority;

/**
 * 角色.
 *
 * @author <a href="mailto:lin-mt@outlook.com">lin-mt</a>
 */
public class Role implements GrantedAuthority {
    
    private static final long serialVersionUID = -5364907730268147700L;
    
    private String roleName;
    
    public String getRoleName() {
        return roleName;
    }
    
    public Role setRoleName(final String roleName) {
        this.roleName = roleName;
        return this;
    }
    
    @Override
    public String getAuthority() {
        return roleName;
    }
    
    @Override
    public boolean equals(final Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        final Role role = (Role) o;
        return this.roleName.equals(role.roleName);
    }
    
    @Override
    public int hashCode() {
        return roleName.hashCode();
    }
}
